package com.qinsoft.frame.utils;
/**
 * title:分页处理
 */
public class PageBean {
    
    private int curPage = 1;        //当前页码
    private int maxPage = 0;        //总花有多少页码
    private int maxRowCount = 0;    //总记录数
    private int rowsPrePage = 12;   //每页码显示多少条数据
    
    public PageBean(int maxRowCount, int rowsPrePage){
            
        this.maxRowCount = maxRowCount;
        this.rowsPrePage = rowsPrePage;
        
        maxPage();
    }
    
    //计算总页码
    private void maxPage()
    {
        if( maxRowCount % rowsPrePage == 0 ){
            
            maxPage = maxRowCount / rowsPrePage;
        }else{      
            
            maxPage = maxRowCount / rowsPrePage + 1;
        }
        if(maxPage == 0 ) maxPage = 1;
    }

    public int getCurPage() {
        return curPage;
    }

    public void setCurPage(int curPage) {
        this.curPage = curPage;
    }

    public int getMaxPage() {
        return maxPage;
    }

    public void setMaxPage(int maxPage) {
        this.maxPage = maxPage;
    }

    public int getMaxRowCount() {
        return maxRowCount;
    }

    public void setMaxRowCount(int maxRowCount) {
        this.maxRowCount = maxRowCount;
    }

    public int getRowsPrePage() {
        return rowsPrePage;
    }

    public void setRowsPrePage(int rowsPrePage) {
        this.rowsPrePage = rowsPrePage;
    }
}
